#include "widget.h"
#include "ui_widget.h"
#include"QLabel"
#include"QLineEdit"
#include"QFormLayout"
#include"QPushButton"
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    QLabel * label1=new QLabel("姓名");
    QLabel * label2=new QLabel("学号");
    QLabel * label3=new QLabel("年龄");
    QLineEdit* eidt1=new QLineEdit();
    QLineEdit* eidt2=new QLineEdit();
    QLineEdit* eidt3=new QLineEdit();
    QPushButton* btn = new QPushButton("提交");
    QFormLayout* layout=new QFormLayout();
    this->setLayout(layout);
    //QSpacerItem* space=new QSpacerItem(20,20);//网格布局没有间隔设置
    layout->addRow(label1,eidt1);//按行添加元素
    layout->addRow(label2,eidt2);
    layout->addRow(label3,eidt3);
    layout->addRow(btn);
    //layout->setItem();
}

Widget::~Widget()
{
    delete ui;
}

